import * as api from "./api";

export default {
  //首页进行中的订单-或未支付订单
  getOrdersIng: isDisLoading => {
    return api.get("/api/orders/ing", "", {
      isDisLoading
    });
  },

  // 查看用户是否可以租借
  getUserRent: params => {
    return api.get(`/api/users/rent-or-not`, params);
  },

  // 通过扫码编号获得计费规则
  getOrdersBilling: params => {
    return api.get(`/api/orders/billing`, params);
  },

  // 租借
  rentOrders: cabinetNo => {
    return api.get(`/api/orders/rent/${cabinetNo}`);
  },

  // 轮询获得租借结果
  getOrdersResult: (orderNo, isDisLoading) => {
    return api.get(`/api/orders/rent-result/${orderNo}`, "", {
      isDisLoading
    });
  },

  // 订单问题上报,第一步确认
  getOrdersInStation: (orderNo, isDisLoading) => {
    return api.get(`/api/orders/question/${orderNo}`, "", {
      isDisLoading
    });
  },

  // 上传图片
  uploadImg: params => {
    return api.post(`/api/common/files/upload`, params);
  },

  // 删除图片
  deldImg: params => {
    return api.del(`/api/common/files`, params);
  },

  // 报损
  postOrdersDamage: params => {
    return api.post(`/api/orders/question/damage`, params);
  },

  // 上报-订单问题
  postOrdersProblem: params => {
    return api.post(`/api/orders/question/order-problem`, params);
  },

  // FAQ问题列表
  getFaq: () => {
    return api.get(`/api/faqs`);
  },

  // 用户反馈
  postFeedback: params => {
    return api.post(`/api/feedback`, params);
  },

  // 获取用户ip地区
  getUserIp: () => {
    return api.get(`/api/users/ip/address`);
  },

  // 信用租借
  creditRent: (params) => {
    return api.post(`/api/orders/credit-rent`, params);
  },  
};
